﻿Public Class Estructura

    Protected Friend Const STR_DISP = 4
    Protected Friend Const STR_VIDA = 10
    Protected Friend Const STR_DEF = 4

    Protected Friend Property Coordenadas As Point
    Protected Friend Property Vida As Integer
    Protected Friend Property Defensa As Integer
    Protected Friend Property Imagen As Image
    Protected Friend Property Disparo As Integer

    Public Sub ComprobarEstructura(ByVal daño As Integer)
        Vida = Vida - daño
    End Sub

    Public Sub New()
        Me.Vida = STR_VIDA
        Me.Disparo = STR_DISP
        Me.Defensa = STR_DEF
        Me.Imagen = My.Resources.CastleMap
    End Sub

    Public Function disparar(ByVal defensor As Batallon) As Integer
        Dim dado As New Dado
        Dim result As Integer
        Dim heridas As Integer
        result = dado.lanzar + Me.Disparo
        If result >= defensor.Tropas(0).Defensa Then
            heridas = heridas + 1
        End If
        Return heridas
    End Function

    Public Function Defender() As Integer
        Dim parada As Integer
        Dim dado As New Dado
        parada = dado.lanzar + Me.Defensa
        Return parada
    End Function
End Class
